/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */
package com.hopes.bizz.close.basic.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hopes.bizz.close.basic.entity.ClosedOperateAuditRecordEntity;
import com.hopes.bizz.close.basic.mapper.ClosedOperateAuditRecordMapper;
import com.hopes.bizz.close.basic.service.ClosedOperateAuditRecordService;
import com.hopes.bizz.close.common.constant.enums.ParkCloseSysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.common.security.util.SecurityUtils;
import org.springframework.stereotype.Service;

import java.util.Calendar;

/**
 * 处理审核记录表
 *
 * @author pig
 * @date 2024-01-22 17:39:25
 */
@Service
public class ClosedOperateAuditRecordServiceImpl extends ServiceImpl<ClosedOperateAuditRecordMapper, ClosedOperateAuditRecordEntity> implements ClosedOperateAuditRecordService {


    @Override
    public boolean buildSaveOperateAuditRecord(Long objId, String handleOperate, Integer handleOperateRes, String handleOperateDesc, String remark) {
        final ClosedOperateAuditRecordEntity entity = new ClosedOperateAuditRecordEntity();
        entity.setObjId(objId);
        entity.setHandleTime(Calendar.getInstance().getTime());
        entity.setHandleUserId(SecurityUtils.getUserId());
        entity.setHandleUserName(SecurityUtils.getUser().getName());
        entity.setHandleOperate(handleOperate);
        entity.setHandleOperateRes(DictResolver.getItemLabelByValue(ParkCloseSysDictEnum.close_general_car_audit_status, handleOperateRes));
        entity.setHandleOperateDesc(handleOperateDesc);
        entity.setHandleOperateRemark(remark);
        return this.save(entity);
    }

}
